<!-- SearchForm -->
<template>
  <div id="SearchForm">
    <el-row :gutter="10">
      <el-col :span="4" class="flex_l">
        <el-button size="small" type="primary" icon="el-icon-plus" @click="AddDataButton">新增</el-button>
      </el-col>
      <el-col :span="20" class="flex_r">
        <el-form ref="SearchForm" :inline="true" :model="SearchForm" size="small">
          <el-form-item prop="keyword">
            <el-input v-model="SearchForm.keyword" clearable placeholder="请输入商品名称" />
          </el-form-item>

          <el-form-item>
            <el-button type="primary" icon="el-icon-search" @click="SearchButton">查询</el-button>
            <el-button type="danger" plain @click="ResetForm">重置</el-button>
          </el-form-item>
        </el-form>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: 'SearchForm',
  data() {
    return {
      SearchForm: {
        keyword: '' // 关键字
      }
    }
  },
  /* HTML DOM加载后马上执行的，如赋值*/
  computed: {},

  /* 观察Vue实例上的数据变动 */
  watch: {},

  /* 模板渲染成html前调用，即通常初始化某些属性值，然后再渲染成视图 */
  created() {},

  /* 模板渲染成html后调用，通常是初始化页面完成后，再对html的dom节点进行一些需要的操作 */
  mounted() {},

  /* methods则必须要有一定的触发条件才能执行 */
  methods: {
    /**
     * @date: 2024-10-30 21:29:32
     * @description: 新增
     * @modifyContent:
     * @author: Forever丿顾北
    **/
    AddDataButton() {
      this.$emit('AddDataButton')
    },
    /**
     * @date: 2024-10-30 21:37:10
     * @description: 查询
     * @modifyContent:
     * @author: Forever丿顾北
    **/
    SearchButton() {
      this.$emit('SearchButton', this.SearchForm)
    },
    /**
     * @date: 2024-10-30 21:37:33
     * @description: 重置
     * @modifyContent:
     * @author: Forever丿顾北
    **/
    ResetForm() {
      console.log('11111111', this.$refs.SearchForm)
      this.$refs.SearchForm.resetFields()
      this.$emit('ResetForm')
    }
  }
}
</script>

<style lang='scss' scoped>

</style>
